<?
  include "../common/db_conn.php";    

  $query_b = "select sb_idx, sb_text from sv_base where sb_idx = 1 limit 1";
  $result_b = mysql_query($query_b);
  $rows_b = mysql_fetch_array($result_b); 
  
  $query_d = "select sd_idx, sd_text from sv_dlist order by sd_idx asc";
  $result_d = mysql_query($query_d);
  $num_rows_d = mysql_num_rows($result_d);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>

<body>
<h1>관리자 페이지</h1>
<h2>안내문</h2>
<form name="frm_notice" method="post" action="q_proc.php" target="ifr"> 
<input type="hidden" name="ptype" value="0">
<textarea name="notice" cols="80" rows="5" ><?=stripslashes($rows_b["sb_text"])?></textarea><br>
<input type="submit" value="안내문 저장">
</form>
<h2>대분류</h2>
<p>
  순서는 미리 정해놓고 '문항'을 만드세요. 
</p>
<form name="frm_division" method="post" action="q_proc.php" target="ifr">
<input type="hidden" name="ptype" value="1">
<table>
  <tr>
    <td>번호</td>
    <td>내용</td>
  </tr>
<? 
  for ($i = 0; $i < $num_rows_d; $i++) 
  {
    $rows_d = mysql_fetch_array($result_d);
?>
  <tr>
    <td><?=$rows_d["sd_idx"]?></td>
    <td><input type="text" value="<?=htmlspecialchars($rows_d["sd_text"])?>" name="d_<?=$i?>" size="80"></td>
    <td><input type="button" value="문항 보기" onClick="location.href='q_list.html?sd_idx=<?=$rows_d["sd_idx"]?>'"></td>
  </tr>
<?
  }
?> 
</table>
<input type="submit" value="대분류 저장">
</form>
<br>
<iframe src="about:blank" name="ifr" width="300" height="300"></iframe>

</body>
</html>
<?
  include "../common/db_close.php";
?>
